﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class OutReceiptQuery : BasePage
    {
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlExternReceiptID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlPoID;
        protected DropDownList ddlReceiptDate;
        protected DropDownList ddlReceiptID;
        protected DropDownList ddlVendorID;
        protected DropDownList ddlVendorName;
        protected HtmlForm F4010;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected HtmlImage img1;
        protected HtmlImage img2;
        protected Label lblExternReceiptID;
        protected Label lblOwnerID;
        protected Label lblPoID;
        protected Label lblReceiptDate;
        protected Label lblReceiptID;
        protected Label lblSys_Code;
        protected Label lblVendorID;
        protected Label lblVendorName;
        protected HtmlLink mycss;
        protected TextBox txtExternReceiptID;
        protected TextBox txtOwnerID;
        protected TextBox txtPoID;
        protected TextBox txtReceiptDate;
        protected TextBox txtReceiptDate2;
        protected TextBox txtReceiptID;
        protected TextBox txtVendorID;
        protected TextBox txtVendorName;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("OutReceiptList.aspx?from=list&action={0}&OwnerID={1}", base.UrlEncode(this.hdnActionID.Value.Trim()), base.Server.UrlEncode(this.txtOwnerID.Text), base.Server.UrlEncode(base.Request.QueryString["OrderID"])), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("OutReceiptList.aspx?action={0}&OwnerID={1}&OrderID={2}", base.UrlEncode(this.hdnActionID.Value.Trim()), base.Server.UrlEncode(this.txtOwnerID.Text), base.Server.UrlEncode(base.Request.QueryString["OrderID"])), false);
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["OwnerID"]))
            {
                this.txtOwnerID.Text = base.Request.QueryString["OwnerID"];
                this.txtOwnerID.Enabled = false;
            }
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlReceiptID, 0);
            base.InitQueryDDL(this.ddlPoID, 0);
            base.InitQueryDDL(this.ddlExternReceiptID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlVendorID, 0);
            base.InitQueryDDL(this.ddlVendorName, 0);
            base.InitQueryDDL(this.ddlReceiptDate, 1);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
                this.LoadData();
            }
        }

        public string ExternReceiptID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternReceiptID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternReceiptID.Text.Trim(), this.ddlExternReceiptID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string PoID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPoID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPoID.Text.Trim(), this.ddlPoID.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptDate.Text.Trim(), this.ddlReceiptDate.SelectedValue, this.txtReceiptDate2.Text.Trim(), "ExpectedReceiptDate");
                }
                return "";
            }
        }

        public string ReceiptID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReceiptID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReceiptID.Text.Trim(), this.ddlReceiptID.SelectedValue);
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorID.Text.Trim(), this.ddlVendorID.SelectedValue);
                }
                return "";
            }
        }

        public string VendorName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorName.Text.Trim()))
                {
                    return base.GetParamsString(this.txtVendorName.Text.Trim(), this.ddlVendorName.SelectedValue);
                }
                return "";
            }
        }
    }
}

